package edu.hunan.cxb18.controller;

import edu.hunan.cxb18.car.Car;
import edu.hunan.cxb18.car.MyCart;
import edu.hunan.cxb18.car.MyCartList;
import edu.hunan.cxb18.result.CommonTypeResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author AuthorName
 * @create 2020-06-12 8:24
 */
@RestController
@RequestMapping("/mycart")
public class MycartController {
    @RequestMapping("/load")
    public CommonTypeResult load(HttpServletRequest request){
        HttpSession session = request.getSession();
        Car mycart = (Car) session.getAttribute("car");
        if(mycart==null) {
            return CommonTypeResult.creat("无数据","false");
        }else {
           return CommonTypeResult.creat(mycart,"success");
        }
    }
}
